package com.ge.pp;

import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class ConnectionDialog extends JDialog {
	public JTextField addr;
	public JTextField docid;
	public boolean canceled = false;
	
	public ConnectionDialog(JFrame parent) throws Exception {
		super(parent, "Connect To Server", true);
		try
		{
			Container c = this.getContentPane();
		c.setLayout(new GridLayout(3,2));
		c.add(new JLabel("Server Address"));
		addr = new JTextField("localhost");
		c.add(addr);
		c.add(new JLabel("Doctor ID"));
		docid = new JTextField();
		c.add(docid);
		JButton con = new JButton("Connect");
		con.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{				
				dispose();
			}});
		c.add(con);
		JButton cancel = new JButton("Cancel");
		cancel.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {				
				canceled= true;
				dispose();
			}		
		});
	
		c.add(cancel);
		pack();
	}
	catch(Exception e)
	{
		throw e;
	}
}}
